﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using FirebirdSql.Data.FirebirdClient;
namespace University
{
    public partial class SOZIALNI_USTANOVY : University.PREMIWCHENNJA
    {
        static string sqlSelect = "SELECT * FROM SOZIALNI_USTANOVY";
        FbDataAdapter da = new FbDataAdapter(sqlSelect, con);
        DataTable dt = new DataTable();
        public SOZIALNI_USTANOVY()
        {
            InitializeComponent();
        }
        public SOZIALNI_USTANOVY(TreeNode node, ContextMenuStrip s, string com, int id)
            : base(node, s, com, id)
        {
            node_id = Convert.ToInt32(mynode.Tag.ToString());
            InitializeComponent();
            da.Fill(dt);
            bindingSource1.DataSource = dt;
            textBox6.DataBindings.Add("Text", bindingSource1, "PREZNACHENNJA");

            bindingSource1.Filter = "UNIQUE_NO =" + node_id;
            if (com == "Remove") { Remove("SOZIALNI_USTANOVY"); }
        }

        public override void Remove(string name)
        {
            base.Remove(name);
        }

        public override void UpdateForm()
        {
            OpenCon();
            UpdateFild("SOZIALNI_USTANOVY", "PREZNACHENNJA", textBox6.Text);

            base.UpdateForm();
        }
        public override void InsertFild(string klas)
        {
            OpenCon();
            FbCommand cmdInsert = new FbCommand("INSERT INTO SOZIALNI_USTANOVY(UNIQUE_NO,PREZNACHENNJA) VALUES(@1,@2)", con);
            cmdInsert.Parameters.AddWithValue("1", textBox1.Text);
            cmdInsert.Parameters.AddWithValue("2", textBox6.Text);
            cmdInsert.ExecuteNonQuery();
            base.InsertFild(klas);
        }
        private void SOZIALNI_USTANOVY_Load(object sender, EventArgs e)
        {

        }
    }
}